package org.kfive.nova.algorithm.Generic;

import java.io.Serializable;

/**
 * Created with IntelliJ IDEA.
 * User: admin
 * Date: 14-5-18
 * Time: 下午6:51
 * To change this template use File | Settings | File Templates.
 */
public class ArrayAlg {

    public static <T extends  Object & Comparable & Serializable> T min(T[]a){
        if(a==null||a.length==0) return  null;
        T smallest = a[0];
        for(int i=1;i<a.length;i++){
            if(smallest.compareTo(a[i])>0){
                smallest = a[i];
            }
        }
        return smallest;
    }
}
